.PHONY: all clean view words

proj_n=paper
pdf_f=${proj_n}.pdf
tex_main=${proj_n}.tex
tex_fs=paper.tex abstract.tex preface.tex implementation.tex\
       summary.tex
bibf=bibs.bib

garbage=$(subst .tex,.aux,${tex_fs})
garbage+=$(proj_n).toc $(proj_n).log $(proj_n).out $(proj_n).bbl $(proj_n).blg

all: $(pdf_f)

# Add BUAApaper.cls as dep just for debug use
# Users can remove it.
$(pdf_f): $(tex_fs) $(bibf) BUAApaper.cls
	xelatex $(tex_main)
	bibtex $(proj_n) || true
	xelatex $(tex_main)
	xelatex $(tex_main)

clean:
	rm $(garbage) 2>/dev/null || true
